import datetime
import os
import pathlib
import shutil
import pytest

pytest.main()

os.system("allure generate -o report temps --clean")

log_name = datetime.datetime.now().strftime("%Y_%m_%d_%H_%M_%S")

shutil.move("logs/pytest.log", f"logs/{log_name}.log")

log_list = list(pathlib.Path("logs").glob("*.log"))
log_list.sort()
log_list.reverse()

for log in log_list[3:]:
    log.unlink()
